// *********************************************************************************
// Project Name : fix_priority arbiter
// Author       : xfsong
// Email        : 1293993416@qq.com
// Create Time  : 2024-05-06
// File Name    : .v
// Module Name  :
// Called By    :
// Abstract     :the 3rd method to achieve fix priority arbiter
//
// 
// *********************************************************************************
// Modification History:
// Date         By              Version                 Change Description
// -----------------------------------------------------------------------
// 2024-05-06    Macro           1.0                     Original
//  
// *********************************************************************************


module fix_priority3(
    input READY0, READY1, READY2, READY3, 
    input READY4, READY5, READY6, READY7,
    output [7:0] GRANT
);

wire [7:0] pre_grant;
wire [7:0] ready;
assign ready = {READY7, READY6, READY5, READY4, READY3, READY2, READY1, READY0};// READY0 has the highest priority
assign pre_grant[0] = 1'b0;

assign pre_grant[7:1] = ready[6:0] | pre_grant[6:0];

assign GRANT = ready & (~pre_grant);

endmodule
